<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<title>heatmap.js Realtime heatmap based on static data</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<style>
			body, html {
				margin:0;
				padding:0;
				font-family:Arial;
			}
			h1 {
				margin-bottom:10px;
			}
			#main {
				position:relative;
				width:940px;
				padding:20px;
				margin:auto;
			}
			#heatmapArea {
				position:relative;
				float:left;
				width:600px;
				height:400px;
				background-image:url(http://www.patrick-wied.at/static/heatmapjs/demo/realtime_heatmap/graphic.png);
				border:1px dashed black;
			}
			#configArea {
				position:relative;
				float:left;
				width:260px;
				padding:20px;
				padding-top:0;
			}
			.btn {
				margin-top:25px;
				padding:10px 20px 10px 20px;
				-moz-border-radius:15px;
				-o-border-radius:15px;
				-webkit-border-radius:15px;
				border-radius:15px;
				border:2px solid black;
				cursor:pointer;
				color:white;
				background-color:black;
			}
			#gen:hover{
				background-color:grey;
				color:black;
			}
			textarea{
				width:260px;
				padding:10px;
				height:200px;
			}
			h2{
				margin-top:0;
			}
		</style>
		<link rel="shortcut icon" type="image/png" href="http://www.patrick-wied.at/img/favicon.png" />
	</head>
	<body>
		<div id="main">
			<h1>Realtime heatmap based on mouse clicks</h1>
			<a href="http://www.patrick-wied.at/static/heatmapjs/" title="heatmap.js">Back to the project page</a><br /><br />
			<div id="heatmapArea">
			
			</div>
			<div id="configArea">
				<h2>Sidenotes</h2>
				This is a demonstration of a canvas heatmap based on static data<br /><br />
				<strong>Note: The object must contain the maximum count</strong>
				<textarea id="data">
{max: 90, data: [
{x: 100, y: 100, count: 80},
{x: 120, y: 120, count: 60},
{x: 100, y: 80, count: 90},
{x: 111, y: 110, count: 60},
{x: 201, y: 150, count: 90},
{x: 311, y: 110, count: 60},
{x: 121, y: 510, count: 70},
{x: 511, y: 110, count: 60},
{x: 211, y: 110, count: 50},
{x: 191, y: 110, count: 20},
{x: 511, y: 110, count: 40}
]}
				</textarea>
				<div id="dataset" class="btn">Apply DataSet</div>
				<div id="gen" class="btn">Generate some random data</div>
			</div>
		</div>
		<script type="text/javascript" src="../../src/heatmap.js"></script>
		<script type="text/javascript">
	
	
		window.onload = function(){
			var xx = h337.create({"element":document.getElementById("heatmapArea"), "radius":25, "visible":true});
			
			xx.get("canvas").onclick = function(ev){
				var pos = h337.util.mousePosition(ev);
				xx.store.addDataPoint(pos[0],pos[1]);
			};
			
			document.getElementById("dataset").onclick = function(){
				var el = document.getElementById("data").value;
				var obj = eval('('+el+')');
				
				// call the heatmap's store's setDataSet method in order to set static data
				xx.store.setDataSet(obj);
			};
			document.getElementById("gen").onclick = function(){
				xx.store.generateRandomDataSet(100);
			};
		};
		
		</script>
	</body>
</html>
